<template>
  <div>
    <div>
      <Modal
        v-model="DriverDetailsModal"
        title="车辆详情"
        width="950"
        @on-cancel="cancel"
        class="Modal-zindex"
      >
        <div>
          <div class="ModalBox">
            <div class="virewhead">
              <div class="headcompany">
                <div class="headcompanyfont">
                  <span>{{ VehicleDetailsLsit.nickName }}</span>
                  <span style="margin-left: 1rem; color: #999">{{
                    VehicleDetailsLsit.mobile
                  }}</span>
                  <samp style="font-size: 16px; font-weight: 600">{{
                    VehicleDetailsLsit.vehicleNum
                  }}</samp>
                  <p style="margin-top: 5px">
                    <samp style="margin-left: 1rem; color: #999">
                      已安全承运{{ VehicleDetailsLsit.relationship }}单</samp
                    >
                  </p>
                </div>
              </div>
              <div class="vehiclebut">
                <!-- <Button size="small"  style="background: #5CACEE">Primary</Button> -->
                <!-- 车辆 -->
              </div>
            </div>

            <!-- 线 -->
            <div class="BoxLine"></div>
            <!-- 详情 -->
            <div class="listDriver">
              <List
                :border="false"
                :split="false"
                header=""
                footer=""
                size="small"
              >
                <ListItem>
                  <span class="listDriverspan">认证状态</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.registStatus == "0"
                      ? "未认证"
                      : VehicleDetailsLsit.registStatus == "1"
                      ? "已认证"
                      : VehicleDetailsLsit.registStatus == "2"
                      ? "审核中"
                      : VehicleDetailsLsit.registStatus == "3"
                      ? "已过期"
                      : VehicleDetailsLsit.registStatus == "4"
                      ? "已注销"
                      : ""
                  }}</span>
                  <!-- <span class="listDriverval">{{
                    VehicleDetailsLsit.registStatus == "0"
                      ? "异常"
                      : VehicleDetailsLsit.registStatus == "1"
                      ? " 正常"
                      : ""
                  }}</span> -->
                </ListItem>
                    <ListItem>
                  <span class="listDriverspan">实际所有人</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.manageUserName
                  }}</span>
                </ListItem>
                    <ListItem>
                  <span class="listDriverspan">驾驶驾驶员</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.driverName
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">车辆牌照号</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.vehicleNum
                  }}</span>
                </ListItem>

                <ListItem>
                  <span class="listDriverspan">车牌颜色</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.colorType | VEHICLE_COLOR
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">车辆类型</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.vehicleCodeType | VEHICLENEWTYPE
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">所有人</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.vehicleOwner
                  }}</span>
                </ListItem>

                <ListItem>
                  <span class="listDriverspan">使用性质</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.useCharacter
                  }}</span>
                </ListItem>

                <ListItem>
                  <span class="listDriverspan">车辆识别代号</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.vin == null
                      ? "--"
                      : VehicleDetailsLsit.vin
                  }}</span>
                </ListItem>

                <ListItem>
                  <span class="listDriverspan">发证机关</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.issuingAuthority
                  }}</span>
                </ListItem>

                <ListItem>
                  <span class="listDriverspan">注册日期</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.registerDate
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">发证日期</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.issueDate
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">车辆能源类型</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.oilType | OILTYPE
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">核定载质量</span>
                  <span class="listDriverval"
                    >{{ VehicleDetailsLsit.approvedLoad }} 吨</span
                  >
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">总质量</span>
                  <span class="listDriverval"
                    >{{ VehicleDetailsLsit.grossMass }} 吨</span
                  >
                </ListItem>
                <!-- 道路运输经营许可证号23232323roadPermitNo     道路运输证号12121212 workFileNo --> 
                <ListItem>
                  <span class="listDriverspan">道路运输证号</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.workFileNo
                  }}</span>
                </ListItem>
                   <ListItem>
                  <span class="listDriverspan">经营许可证号</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.roadPermitNo
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">挂车牌照号</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.trailerNum
                  }}</span>
                </ListItem>
                <ListItem>
                  <span class="listDriverspan">备注</span>
                  <span class="listDriverval">{{
                    VehicleDetailsLsit.exportRemarks
                  }}</span>
                </ListItem>
              </List>
            </div>
            <!-- 线 -->
            <div class="BoxLine"></div>
            <!-- 照片 -->
            <div class="Vehiclehea">
              <div class="Vehicleheadiv">
                <div>
                  <div class="Vehicleheabnt" style="margin-left: 1rem">
                    <Button disabled style="width: 135px">
                      行驶证主页(主)</Button
                    >
                  </div>
                  <div class="Vehicleheaimg" style="margin-left: 1rem">
                    <span v-if="this.DrivingLicenseLomePage != ''">
                      <img
                        :src="this.DrivingLicenseLomePage"
                        @click="showPic(DrivingLicenseLomePage)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button disabled style="width: 135px">
                      行驶证副页(主)</Button
                    >
                  </div>
                  <div class="Vehicleheaimg">
                    <span v-if="this.CopyDrivingLicense != ''">
                      <img
                        :src="this.CopyDrivingLicense"
                        @click="showPic(CopyDrivingLicense)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button
                      disabled
                      style="width: 135px; ont-size: 13px; padding: 0 2px"
                    >
                      行驶证副页背面(主)</Button
                    >
                  </div>
                  <div class="Vehicleheaimgalone">
                    <span v-if="this.BackDuplicatePage != ''">
                      <img
                        :src="this.BackDuplicatePage"
                        @click="showPic(BackDuplicatePage)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button disabled style="width: 135px">
                      车辆运输证(主)</Button
                    >
                  </div>
                  <div class="Vehicleheaimg">
                    <span v-if="this.VehicleOperationCertificate != ''">
                      <img
                        :src="this.VehicleOperationCertificate"
                        @click="showPic(VehicleOperationCertificate)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <!-- <div>
                  <div class="Vehicleheabnt">
                    <Button style="width: 135px" disabled> 经营许可证</Button>
                  </div>
                  <div class="Vehicleheaimglone1">
                    <span v-if="this.Businessense != ''">
                      <img
                        :src="this.Businessense"
                        @click="showPic(Businessense)"
                        alt=""
                    /></span>
                  </div>
                </div> -->
              </div>
            </div>
            <div class="Vehiclehea">
              <div class="Vehicleheadiv">
                <div>
                  <div class="Vehicleheabnt" style="margin-left: 1rem">
                    <Button style="width: 135px" disabled>
                      行驶证主页(挂)</Button
                    >
                  </div>
                  <div class="Vehicleheaimg" style="margin-left: 1rem">
                    <span v-if="this.DrivingLicenseOwner != ''">
                      <img
                        :src="this.DrivingLicenseOwner"
                        @click="showPic(DrivingLicenseOwner)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button style="width: 135px" disabled>
                      行驶证副页(挂)</Button
                    >
                  </div>
                  <div class="Vehicleheaimg">
                    <span v-if="this.DrivingSecondaryPage != ''">
                      <img
                        :src="this.DrivingSecondaryPage"
                        @click="showPic(DrivingSecondaryPage)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button
                      disabled
                      style="width: 135px; ont-size: 13px; padding: 0 2px"
                    >
                      行驶证副页背面(挂)</Button
                    >
                  </div>
                  <div class="Vehicleheaimgalone">
                    <span v-if="this.DrivingLicenseAssistant != ''">
                      <img
                        :src="this.DrivingLicenseAssistant"
                        @click="showPic(DrivingLicenseAssistant)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <div>
                  <div class="Vehicleheabnt">
                    <Button disabled style="width: 135px">
                      车辆运输证(挂)</Button
                    >
                  </div>
                  <div class="Vehicleheaimone3">
                    <span v-if="this.BusinessLicense != ''">
                      <img
                        :src="this.BusinessLicense"
                        @click="showPic(BusinessLicense)"
                        alt=""
                    /></span>
                  </div>
                </div>
                <!-- <div>
                  <div class="Vehicleheabnt">
                    <Button style="width: 135px" disabled>
                      营业执照/身份证</Button
                    >
                  </div>
                  <div class="Vehicleheaimg">
                    <span v-if="this.VehicleOperationCertif != ''">
                      <img
                        :src="this.VehicleOperationCertif"
                        @click="showPic(VehicleOperationCertif)"
                        alt=""
                    /></span>
                  </div>
                </div> -->
              </div>
            </div>
            <!-- 线 -->
            <div class="BoxLine"></div>
            <!-- 详情 -->

            <!-- 标签页 -->
            <!-- 线 -->
            <div class="BoxLine"></div>
            <div style="margin-top: 10px"></div>
          </div>
        </div>
        <div slot="footer"></div>
      </Modal>
    </div>
  </div>
</template>

<script>
import { getDriverLicenseId } from "@/api/index";
import { getStore, setStore } from "@/libs/storage";
export default {
  data() {
    return {
      DriverDetailsModal: this.VehicleDetailsModalue,
      VehicleDetailsLsit: {},
      VehicleDetailsId: this.VehicleDetailsId,
      header: {
        accessToken: getStore("accessToken"),
      },
      accessToken: getStore("accessToken"),
      DrivingLicenseLomePage: "", //行驶证主页(主)
      CopyDrivingLicense: "", //行驶证副页(主)
      BackDuplicatePage: "", //行驶证副页背面(主)
      VehicleOperationCertificate: "", //车辆运输证(主)<
      Businessense: "", //经营许可证

      DrivingLicenseOwner: "", //行驶证主页(挂)
      DrivingSecondaryPage: "", //行驶证副页(挂
      DrivingLicenseAssistant: "", //行驶证副页背面(挂)
      VehicleOperationCertif: "", //车辆运输证(挂)
      BusinessLicense: "", //营业执照/身份证
    };
  },
  props: {
    VehicleDetailsModalue: {
      type: Boolean,
      default: false,
    },
    // data: {
    //   type: Object,
    // },
    VehicleDetailsId: {
      type: String,
      default: "",
    },
  },
  watch: {
    VehicleDetailsModalue(val) {
      this.setCurrentValue(val);
    },

    VehicleDetailsId(val) {
      if (val != "") {
        this.VehicleDetailsId = val;
        this.getDataList();
      }
    },
  },

  methods: {
    // 关闭
    cancel() {
      this.$emit("VehicleDetailsEnd", this.DriverDetailsModal);
    },
    setCurrentValue(value) {
      this.DrivingLicenseLomePage = ""; //行驶证主页(主)
      this.CopyDrivingLicense = ""; //行驶证副页(主)
      this.BackDuplicatePage = ""; //行驶证副页背面(主)
      this.VehicleOperationCertificate = ""; //车辆运输证(主)<
      this.Businessense = ""; //经营许可证

      this.DrivingLicenseOwner = ""; //行驶证主页(挂)
      this.DrivingSecondaryPage = ""; //行驶证副页(挂
      this.DrivingLicenseAssistant = ""; //行驶证副页背面(挂)
      this.VehicleOperationCertif = ""; //车辆运输证(挂)
      this.BusinessLicense = ""; //营业执照/身份证
      if (value === this.DriverDetailsModal) {
        return;
      }
      this.DriverDetailsModal = value;
    },
    getAge(value) {
      let birthdays = new Date(value);
      let d = new Date();
      let age =
        d.getFullYear() -
        birthdays.getFullYear() -
        (d.getMonth() < birthdays.getMonth() ||
        (d.getMonth() == birthdays.getMonth() &&
          d.getDate() < birthdays.getDate())
          ? 1
          : 0);
      return age;
    }, // 拼接照片
    MosaicPhotos(val) {
      let img =
        this.$baseUrl +
        "/freight/file/view/" +
        val +
        "?accessToken=" +
        this.accessToken +
        "&preview=true";
      return img;
    },
    // 获取数据
    getDataList() {
      getDriverLicenseId({ vehicleId: this.VehicleDetailsId }).then((res) => {
        if (res.code == 200) {
          this.VehicleDetailsLsit = res.result;
          //   vehicleLicenseFontPicFileID; //行驶证正面地址
          //   vehicleLicenseBackPicFileID; //行驶证反面地址
          //   trailerLicenseFontPicFileID; //挂车正面地址")
          //   trailerLicenseBackPicFileID; //挂车反面地址"
          //   vehicleWorkLicenseFileID; //车辆运营证
          //   trailerWorkLicenseFileID; //挂车运营证
          //   roadOperPermitPicFileID; //道路经营许可证
          //   busLicenseOrCardPicFileID; //营业执照/身份证
          //   xszFyBmPicFileID; //行驶证副页 背面
          //   xszGcFyBmPicFileID; //行驶证(挂车)副页 背面

          if (this.VehicleDetailsLsit.vehicleLicenseFontPicFileID != null) {
            this.DrivingLicenseLomePage = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.vehicleLicenseFontPicFileID
            );
          }
          if (this.VehicleDetailsLsit.vehicleLicenseBackPicFileID != null) {
            this.CopyDrivingLicense = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.vehicleLicenseBackPicFileID
            );
          }
          if (this.VehicleDetailsLsit.trailerLicenseFontPicFileID != null) {
            this.DrivingLicenseOwner = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.trailerLicenseFontPicFileID
            );
          }

          if (this.VehicleDetailsLsit.trailerLicenseBackPicFileID != null) {
            this.DrivingSecondaryPage = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.trailerLicenseBackPicFileID
            );
          }
          if (this.VehicleDetailsLsit.vehicleWorkLicenseFileID != null) {
            this.VehicleOperationCertificate = this.headPortrait =
              this.MosaicPhotos(
                this.VehicleDetailsLsit.vehicleWorkLicenseFileID
              );
          }
          if (this.VehicleDetailsLsit.trailerWorkLicenseFileID != null) {
            this.VehicleOperationCertif = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.trailerWorkLicenseFileID
            );
          }
          if (this.VehicleDetailsLsit.roadOperPermitPicFileID != null) {
            this.Businessense = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.roadOperPermitPicFileID
            );
          }
          // if (this.VehicleDetailsLsit.busLicenseOrCardPicFileID != null) {
          //   this.BusinessLicense = this.headPortrait = this.MosaicPhotos(
          //     this.VehicleDetailsLsit.busLicenseOrCardPicFileID
          //   );
          // }

          if (this.VehicleDetailsLsit.trailerWorkLicenseFileID != null) {
            this.BusinessLicense = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.trailerWorkLicenseFileID
            );
          }
          if (this.VehicleDetailsLsit.xszFyBmPicFileID != null) {
            this.BackDuplicatePage = this.headPortrait = this.MosaicPhotos(
              this.VehicleDetailsLsit.xszFyBmPicFileID
            );
          }
          if (this.VehicleDetailsLsit.xszGcFyBmPicFileID != null) {
            this.DrivingLicenseAssistant = this.headPortrait =
              this.MosaicPhotos(this.VehicleDetailsLsit.xszGcFyBmPicFileID);
          }
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    showPic(v) {
      let image = new Image();
      image.src = v;
      let viewer = new Viewer(image, {
        hidden: function () {
          viewer.destroy();
        },
      });
      viewer.show();
    },
  },

  created() {},
};
</script>

<style lang="less">
.listDriver {
  .ivu-list-small .ivu-list-item {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

.my-content {
  width: 100px;
}
.my-limitation {
  width: 170px;
}
.Line {
  // border-bottom: 1px solid #eee;
  // border-bottom-color: rgb(255, 255, 255);
  border: 0;
  border-top: 1px solid #eee;
  border-top-width: 1px;
  border-top-style: solid;
  border-top-color: rgb(238, 238, 238);
  border-bottom: 1px solid #fff;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: rgb(255, 255, 255);
  margin: 20px 0;
}
.listDriver {
  margin-top: 15px;
  // margin-left: 30px;
  .listDriverspan {
    text-align: right;
    width: 100px;
    color: #999;
  }
  .listDriverval {
    margin-left: 15px;
  }
}
.Owner {
  margin-left: 20px;
  // height: 80px;
  display: flex;
  .Ownerportrait {
    width: 60px;
    height: 60px;
    img {
      margin-top: 20px;
      width: 100%;
      height: 100%;
    }
  }
  .OwnerName {
    margin-left: 17px;
    padding: 25px 0;
    .OwnerName1 {
      margin-left: 10px;
      color: #999999;
    }
    .Owner-company {
      margin-top: 10px;
      cursor: pointer;
    }
  }
}
.ReasonRejection {
  color: #08c;
  margin-left: -600px;
  padding: 25px 0;
  margin-top: 20px;
}
.ReasonsFailureAudit {
  color: red;
}
.Ownertiem {
  padding: 25px 0;
  margin-top: 2px;
  .statee,
  .implemented,
  .end,
  .refuse,
  .AuditFailed,
  .quotation,
  .deeltes {
    width: 50px;
    margin-bottom: 10px;
    background-color: rgb(70, 136, 71);
    color: #fff;
    // line-height: 55px;
    padding: 2px 0;
    text-align: center;
    font-size: 12px;
    margin-left: 9px;
    border-radius: 3px;
    display: inline-block;
    margin-left: 103px;
  }
  .quotation {
    background-color: rgb(70, 136, 71);
  }
  .implemented {
    background-color: #2d8cf0;
  }
  .deeltes {
    background-color: #d3d3d3;
  }
  .AuditFailed {
    background-color: #dc143c;
    width: 70px;
    margin-left: 83px;
  }
}
.CarrierSource {
  width: 70px;
  margin-bottom: 10px;
  background-color: #808080;
  color: #fff;
  // line-height: 55px;
  padding: 2px 0;
  text-align: center;
  font-size: 12px;
  margin-left: 25px;
  border-radius: 3px;
  display: inline-block;
}
.butTable {
  width: 100%;
  padding: 5px;
  // border: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  // background-color: #f8f8f9;
  .butTableoffer {
    font-size: 16px;
    font-weight: 700;
    margin-top: 5px;
    margin-left: 5px;
    font-size: 16px;
    margin-bottom: 6px;
    span {
      font-size: 14px;
      font-weight: 400;
      // color: #909399;
    }
  }
}
.Cardokbtn {
  position: relative;
  bottom: -5px;
  left: 0;
}
.okbtn {
  z-index: 99999;
  width: 100%;
  margin-top: -15px;
  background-color: #f5f5f5;
  border: 1px solid #cdcdcd;
  height: 70px;
  line-height: 70px;
}
.ModalBox {
  padding: 0 5px;
  overflow: auto;
  height: 30rem;
  .virewhead {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #eee;
    .headPortrait {
      margin-left: 2rem;
      width: 50px;
      height: 50px;
      margin-top: 1rem;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .headcompany {
      width: 300px;
      font-size: 14px;
      font-weight: normal;
      .headcompanyfont {
        margin-top: 23px;
      }
      .headcRate {
        .ivu-rate-star {
          width: 8px;
          height: 8px;
        }
      }
    }
    .vehiclebut {
      width: 80px;
      padding: 5px;
      display: inline-block;
      // background: #ff9900;
      // color: #fff;
      font-size: 10px;
      text-align: center;
      margin-top: 30px;
      margin-bottom: 30px;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      border-radius: 5px;
      margin-right: 1rem;
      height: 28px;
    }
  }
  .headdetails {
    margin: 10px 0;
  }
}
.Vehiclehea {
  margin: 10px 0;
  display: flex;
  .Vehicleheafontsiz {
    margin-left: 2rem;
  }
  .Vehicleheadiv {
    display: flex;
  }
  .Vehicleheaimg,
  .Vehicleheaimgalone,
  .Vehicleheaimglone1,
  .Vehicleheaimone3 {
      cursor: pointer;
    margin-left: 2rem;
    width: 135px;
    height: 80px;
    padding: 2px;
    border: 1px solid #eee;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .Vehicleheabnt {
    margin-left: 2rem;
    margin-top: 5px;
    font-size: 14px;
    margin-bottom: 6px;
  }
  .complaintTabs {
    margin-top: 10px;
    display: flex;
  }
  .Vehicleheaimgalone {
    width: 135px;
  }
  .Vehicleheaimglone1 {
    width: 135px;
  }
  .Vehicleheaimone3 {
    width: 135px;
  }
}
.BoxLine {
  content: "";
  width: 10px;
  height: 10px;
  // border-bottom: 1px solid #eee;
  position: absolute;
  top: 22px;
  right: -10px;
}
// .BoxLineanf::after {
//   content: "";
//   width: 10px;
//   height: 10px;
//   border-bottom: 1px solid #dcdee2;
//   position: absolute;
//   top: 22px;
//   right: -10px;
// }
.ListItemcss {
  height: 200px;
  overflow: auto;
}
.ListItemMetacss {
  margin-left: 40px;
}
.ListItemMetac1 {
  width: 350px;
  margin-left: 110px;
  color: #999999;
  font-size: 10px;
}
.el-descriptions__header {
  margin-bottom: 10px;
}
.NotFilled {
  font-size: 14px;
  color: #a9a9a9;
}
.LengthvehicleType {
  width: 250px;
  // white-space: nowrap;
  // overflow: hidden;
  // text-overflow: ellipsis;
}

.Modal-zindex {
  .ivu-modal-wrap,
  .ivu-modal-mask {
    z-index: 2000 !important;
  }
}
</style>
